home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 2 / Amiga Tools 2.iso / tex / macros / source / contrib / williams / algorithm.sty next >
Text File  |  1995-03-09  |  2KB  |  78 lines

  1. % ALGORITHM STYLE -- Released 4 May 1994
  2. %    for LaTeX-2e
  3. % Copyright -- 1994 Peter Williams
  4. \NeedsTeXFormat{LaTeX2e}
  5. \ProvidesPackage{algorithm}
  6. \typeout{Document Style `algorithm' - floating environment}
  7.  
  8. \RequirePackage{float}
  9. \RequirePackage{ifthen}
  10. \newcommand{\ALG@within}{nothing}
  11. \newboolean{ALG@within}
  12. \setboolean{ALG@within}{false}
  13. \newcommand{\ALG@floatstyle}{ruled}
  14. \newcommand{\ALG@name}{Algorithm}
  15.  
  16. % Declare Options
  17. % first appearance
  18. \DeclareOption{plain}{
  19.   \renewcommand{\ALG@floatstyle}{plain}
  20. }
  21. \DeclareOption{ruled}{
  22.   \renewcommand{\ALG@floatstyle}{ruled}
  23. }
  24. \DeclareOption{boxed}{
  25.   \renewcommand{\ALG@floatstyle}{boxed}
  26. }
  27. % then numbering convention
  28. \DeclareOption{part}{
  29.   \renewcommand{\ALG@within}{part}
  30.   \setboolean{ALG@within}{true}
  31. }
  32. \DeclareOption{chapter}{
  33.   \renewcommand{\ALG@within}{chapter}
  34.   \setboolean{ALG@within}{true}
  35. }
  36. \DeclareOption{section}{
  37.   \renewcommand{\ALG@within}{section}
  38.   \setboolean{ALG@within}{true}
  39. }
  40. \DeclareOption{subsection}{
  41.   \renewcommand{\ALG@within}{subsection}
  42.   \setboolean{ALG@within}{true}
  43. }
  44. \DeclareOption{subsubsection}{
  45.   \renewcommand{\ALG@within}{subsubsection}
  46.   \setboolean{ALG@within}{true}
  47. }
  48. \DeclareOption{nothing}{
  49.   \renewcommand{\ALG@within}{nothing}
  50.   \setboolean{ALG@within}{true}
  51. }
  52. \DeclareOption*{\edef\ALG@name{\CurrentOption}}
  53.  
  54. % ALGORITHM
  55. %
  56. \ProcessOptions
  57. \floatstyle{\ALG@floatstyle}
  58. \ifthenelse{\boolean{ALG@within}}{
  59.   \ifthenelse{\equal{\ALG@within}{part}}
  60.      {\newfloat{algorithm}{htbp}{loa}[part]}{}
  61.   \ifthenelse{\equal{\ALG@within}{chapter}}
  62.      {\newfloat{algorithm}{htbp}{loa}[chapter]}{}
  63.   \ifthenelse{\equal{\ALG@within}{section}}
  64.      {\newfloat{algorithm}{htbp}{loa}[section]}{}
  65.   \ifthenelse{\equal{\ALG@within}{subsection}}
  66.      {\newfloat{algorithm}{htbp}{loa}[subsection]}{}
  67.   \ifthenelse{\equal{\ALG@within}{subsubsection}}
  68.      {\newfloat{algorithm}{htbp}{loa}[subsubsection]}{}
  69.   \ifthenelse{\equal{\ALG@within}{nothing}}
  70.      {\newfloat{algorithm}{htbp}{loa}}{}
  71. }{
  72.   \newfloat{algorithm}{htbp}{loa}
  73. }
  74. \floatname{algorithm}{\ALG@name}
  75.  
  76. \newcommand{\listofalgorithms}{\listof{algorithm}{List of \ALG@name s}}
  77.  
  78.